﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICopyData.cs" company="">
//   
// </copyright>
// <summary>
//   The CopyData interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Libium.Core
{
    using System.Collections.Generic;

    /// <summary>
    /// The CopyData interface.
    /// </summary>
    public interface ICopyData
    {
        #region Public Properties

        /// <summary>
        ///   Gets the formats.
        /// </summary>
        IEnumerable<string> Formats { get; }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// Gets named value from data
        /// </summary>
        /// <param name="format">
        /// The format of the value to get 
        /// </param>
        /// <param name="action">
        /// Action to take when value of specified format is not found. <see cref="NotExistsAction"/> 
        /// </param>
        /// <typeparam name="T">
        /// Type of value. If value has another type then value will be converted 
        /// </typeparam>
        /// <returns>
        /// Value of specified format if available and converted to type T 
        /// </returns>
        T GetValue<T>(string format, NotExistsAction action = NotExistsAction.ThrowException);

        /// <summary>
        /// The is exist.
        /// </summary>
        /// <param name="format">
        /// The format. 
        /// </param>
        /// <returns>
        /// The <see cref="bool"/> . 
        /// </returns>
        bool IsExist(string format);

        /// <summary>
        /// The set value.
        /// </summary>
        /// <param name="format">
        /// The format. 
        /// </param>
        /// <param name="value">
        /// The value. 
        /// </param>
        void SetValue(string format, ICopyValue value);

        #endregion
    }
}